package com.aispeech.asr.comm.metrics;

import org.apache.commons.lang3.StringUtils;

public abstract class MetricsBase {
    private static String hostname;
    private static String nodename;
    private static String env;

    public static String HostName() {
        if (StringUtils.isAnyEmpty(hostname)) {
            hostname = System.getenv().getOrDefault("HOSTNAME", "default");
        }

        return hostname;
    }

    public static String NodeName() {
        if (StringUtils.isAnyEmpty(nodename)) {
            nodename = System.getenv().getOrDefault("NODENAME", HostName());
        }

        return nodename;
    }

    public static String Env() {
        if (StringUtils.isAnyEmpty(env)) {
            env = System.getenv().getOrDefault("ENV", "dev");
        }

        return env;
    }
}
